Fix "deleting" filename by adding another boolean parameter to
authorOwen Taylor <otaylor@redhat.com>
Thu, 17 Jan 2002 01:37:06 +0000 (01:37 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Thu, 17 Jan 2002 01:37:06 +0000 (01:37 +0000)
Wed Jan 16 20:28:38 2002  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkfilesel.c: Fix "deleting" filename by adding
another boolean parameter to file_selection_populate() -
whether to clear the entry. Also, never fill in the
entry when the user clicks on something in the
directory list. (#6791, Reported by Jos Dehaes and many,
many, many others.)

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkfilesel.c

index 2be9a43aaa5e069cb0251740cd569b0278c36c84..1fd4ec80f0bd59cf694f93835b3369c537b0e6bf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Wed Jan 16 20:28:38 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkfilesel.c: Fix "deleting" filename by adding
+       another boolean parameter to file_selection_populate() -
+       whether to clear the entry. Also, never fill in the
+       entry when the user clicks on something in the 
+       directory list. (#6791, Reported by Jos Dehaes and many,
+       many, many others.)
+
 2002-01-16  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextview.c (gtk_text_view_scroll_pages): update
index 2be9a43aaa5e069cb0251740cd569b0278c36c84..1fd4ec80f0bd59cf694f93835b3369c537b0e6bf 100644 (file)
@@ -1,3 +1,12 @@
+Wed Jan 16 20:28:38 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkfilesel.c: Fix "deleting" filename by adding
+       another boolean parameter to file_selection_populate() -
+       whether to clear the entry. Also, never fill in the
+       entry when the user clicks on something in the 
+       directory list. (#6791, Reported by Jos Dehaes and many,
+       many, many others.)
+
 2002-01-16  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextview.c (gtk_text_view_scroll_pages): update
index 2be9a43aaa5e069cb0251740cd569b0278c36c84..1fd4ec80f0bd59cf694f93835b3369c537b0e6bf 100644 (file)
@@ -1,3 +1,12 @@
+Wed Jan 16 20:28:38 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkfilesel.c: Fix "deleting" filename by adding
+       another boolean parameter to file_selection_populate() -
+       whether to clear the entry. Also, never fill in the
+       entry when the user clicks on something in the 
+       directory list. (#6791, Reported by Jos Dehaes and many,
+       many, many others.)
+
 2002-01-16  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextview.c (gtk_text_view_scroll_pages): update
index 2be9a43aaa5e069cb0251740cd569b0278c36c84..1fd4ec80f0bd59cf694f93835b3369c537b0e6bf 100644 (file)
@@ -1,3 +1,12 @@
+Wed Jan 16 20:28:38 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkfilesel.c: Fix "deleting" filename by adding
+       another boolean parameter to file_selection_populate() -
+       whether to clear the entry. Also, never fill in the
+       entry when the user clicks on something in the 
+       directory list. (#6791, Reported by Jos Dehaes and many,
+       many, many others.)
+
 2002-01-16  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextview.c (gtk_text_view_scroll_pages): update
index 2be9a43aaa5e069cb0251740cd569b0278c36c84..1fd4ec80f0bd59cf694f93835b3369c537b0e6bf 100644 (file)
@@ -1,3 +1,12 @@
+Wed Jan 16 20:28:38 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkfilesel.c: Fix "deleting" filename by adding
+       another boolean parameter to file_selection_populate() -
+       whether to clear the entry. Also, never fill in the
+       entry when the user clicks on something in the 
+       directory list. (#6791, Reported by Jos Dehaes and many,
+       many, many others.)
+
 2002-01-16  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextview.c (gtk_text_view_scroll_pages): update
index 2be9a43aaa5e069cb0251740cd569b0278c36c84..1fd4ec80f0bd59cf694f93835b3369c537b0e6bf 100644 (file)
@@ -1,3 +1,12 @@
+Wed Jan 16 20:28:38 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkfilesel.c: Fix "deleting" filename by adding
+       another boolean parameter to file_selection_populate() -
+       whether to clear the entry. Also, never fill in the
+       entry when the user clicks on something in the 
+       directory list. (#6791, Reported by Jos Dehaes and many,
+       many, many others.)
+
 2002-01-16  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextview.c (gtk_text_view_scroll_pages): update
index 2be9a43aaa5e069cb0251740cd569b0278c36c84..1fd4ec80f0bd59cf694f93835b3369c537b0e6bf 100644 (file)
@@ -1,3 +1,12 @@
+Wed Jan 16 20:28:38 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkfilesel.c: Fix "deleting" filename by adding
+       another boolean parameter to file_selection_populate() -
+       whether to clear the entry. Also, never fill in the
+       entry when the user clicks on something in the 
+       directory list. (#6791, Reported by Jos Dehaes and many,
+       many, many others.)
+
 2002-01-16  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextview.c (gtk_text_view_scroll_pages): update
index 927fb58a547a2f4e627f5cafaa72e65c80596fd7..88e620940ce291ef1c90b4f9e67290a7904dfa69 100644 (file)
@@ -381,7 +381,8 @@ static void gtk_file_selection_dir_button (GtkWidget *widget,
 
 static void gtk_file_selection_populate      (GtkFileSelection      *fs,
                                              gchar                 *rel_path,
-                                             gint                   try_complete);
+                                             gboolean               try_complete,
+                                             gboolean               reset_entry);
 static void gtk_file_selection_abort         (GtkFileSelection      *fs);
 
 static void gtk_file_selection_update_history_menu (GtkFileSelection       *fs,
@@ -733,7 +734,7 @@ gtk_file_selection_init (GtkFileSelection *filesel)
     }
   else
     {
-      gtk_file_selection_populate (filesel, "", FALSE);
+      gtk_file_selection_populate (filesel, "", FALSE, TRUE);
     }
 
   gtk_widget_grab_focus (filesel->selection_entry);
@@ -1064,7 +1065,7 @@ gtk_file_selection_set_filename (GtkFileSelection *filesel,
       name = last_slash + 1;
     }
 
-  gtk_file_selection_populate (filesel, buf, FALSE);
+  gtk_file_selection_populate (filesel, buf, FALSE, TRUE);
 
   if (filesel->selection_entry)
     gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), name);
@@ -1120,7 +1121,7 @@ gtk_file_selection_complete (GtkFileSelection *filesel,
 
   if (filesel->selection_entry)
     gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), pattern);
-  gtk_file_selection_populate (filesel, (gchar*) pattern, TRUE);
+  gtk_file_selection_populate (filesel, (gchar*) pattern, TRUE, TRUE);
 }
 
 static void
@@ -1169,7 +1170,7 @@ gtk_file_selection_map (GtkWidget *widget)
   GtkFileSelection *filesel = GTK_FILE_SELECTION (widget);
 
   /* Refresh the contents */
-  gtk_file_selection_populate (filesel, "", FALSE);
+  gtk_file_selection_populate (filesel, "", FALSE, FALSE);
   
   GTK_WIDGET_CLASS (parent_class)->map (widget);
 }
@@ -1270,7 +1271,7 @@ gtk_file_selection_create_dir_confirmed (GtkWidget *widget,
   g_free (sys_full_path);
   
   gtk_widget_destroy (fs->fileop_dialog);
-  gtk_file_selection_populate (fs, "", FALSE);
+  gtk_file_selection_populate (fs, "", FALSE, FALSE);
 }
   
 static void
@@ -1392,7 +1393,7 @@ gtk_file_selection_delete_file_confirmed (GtkWidget *widget,
   g_free (sys_full_path);
   
   gtk_widget_destroy (fs->fileop_dialog);
-  gtk_file_selection_populate (fs, "", FALSE);
+  gtk_file_selection_populate (fs, "", FALSE, TRUE);
 }
 
 static void
@@ -1531,8 +1532,12 @@ gtk_file_selection_rename_file_confirmed (GtkWidget *widget,
                             sys_old_filename, sys_new_filename,
                             g_strerror (errno));
       gtk_file_selection_fileop_error (fs, buf);
+      goto out2;
     }
   
+  gtk_file_selection_populate (fs, "", FALSE, FALSE);
+  gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), file);
+  
  out2:
   g_free (sys_old_filename);
 
@@ -1542,7 +1547,6 @@ gtk_file_selection_rename_file_confirmed (GtkWidget *widget,
   g_free (sys_new_filename);
   
   gtk_widget_destroy (fs->fileop_dialog);
-  gtk_file_selection_populate (fs, "", FALSE);
 }
   
 static void
@@ -1672,7 +1676,7 @@ gtk_file_selection_key_press (GtkWidget   *widget,
 #endif
       text = g_strdup (gtk_entry_get_text (GTK_ENTRY (fs->selection_entry)));
 
-      gtk_file_selection_populate (fs, text, TRUE);
+      gtk_file_selection_populate (fs, text, TRUE, TRUE);
 
       g_free (text);
 
@@ -1682,7 +1686,6 @@ gtk_file_selection_key_press (GtkWidget   *widget,
   return FALSE;
 }
 
-
 static void
 gtk_file_selection_history_callback (GtkWidget *widget,
                                     gpointer   data)
@@ -1700,7 +1703,7 @@ gtk_file_selection_history_callback (GtkWidget *widget,
     
     if (callback_arg->menu_item == widget)
       {
-       gtk_file_selection_populate (fs, callback_arg->directory, FALSE);
+       gtk_file_selection_populate (fs, callback_arg->directory, FALSE, FALSE);
        break;
       }
     
@@ -1846,34 +1849,17 @@ gtk_file_selection_dir_button (GtkWidget      *widget,
                               gpointer        user_data)
 {
   GtkFileSelection *fs = NULL;
-  gchar *filename, *temp = NULL;
+  gchar *filename = NULL;
 
   g_return_if_fail (GTK_IS_CLIST (widget));
 
   fs = GTK_FILE_SELECTION (user_data);
   g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
 
-  gtk_clist_get_text (GTK_CLIST (fs->dir_list), row, 0, &temp);
-  filename = g_strdup (temp);
+  gtk_clist_get_text (GTK_CLIST (fs->dir_list), row, 0, &filename);
 
-  if (filename)
-    {
-      if (bevent)
-       switch (bevent->type)
-         {
-         case GDK_2BUTTON_PRESS:
-           gtk_file_selection_populate (fs, filename, FALSE);
-           break;
-         
-         default:
-           gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
-           break;
-         }
-      else
-       gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
-
-      g_free (filename);
-    }
+  if (filename && bevent && bevent->type == GDK_2BUTTON_PRESS)
+    gtk_file_selection_populate (fs, filename, FALSE, FALSE);
 }
 
 #if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN)
@@ -1923,7 +1909,8 @@ win32_gtk_add_drives_to_dir_list (GtkWidget *the_dir_list)
 static void
 gtk_file_selection_populate (GtkFileSelection *fs,
                             gchar            *rel_path,
-                            gint              try_complete)
+                            gboolean          try_complete,
+                            gboolean          reset_entry)
 {
   CompletionState *cmpl_state;
   PossibleCompletion* poss;
@@ -2016,7 +2003,7 @@ gtk_file_selection_populate (GtkFileSelection *fs,
 
               did_recurse = TRUE;
 
-              gtk_file_selection_populate (fs, dir_name, TRUE);
+              gtk_file_selection_populate (fs, dir_name, TRUE, TRUE);
 
               g_free (dir_name);
             }
@@ -2035,7 +2022,7 @@ gtk_file_selection_populate (GtkFileSelection *fs,
            gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), rem_path);
         }
     }
-  else
+  else if (reset_entry)
     {
       if (fs->selection_entry)
        gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), "");